bitkeeper revision 1.1439 (428a6cf5pJzUJXByrppn04a8boHuAw)
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 17 May 2005 22:15:17 +0000 (22:15 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Tue, 17 May 2005 22:15:17 +0000 (22:15 +0000)
Fix virq delivery in Xend.
xcs.c:
  Fix binding to virq's -- setup evtchn binding.
channel.py:
  Use VIRQ_DOM_EXC as exported from xc.  Also don't bind to virq's we
  don't care for or which won't get delivered to us anyway.
xc.c:
  Export VIRQ_DOM_EXC to python.
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
tools/python/xen/lowlevel/xc/xc.c
tools/python/xen/xend/server/channel.py
tools/xcs/xcs.c

index a7b4aba7c6e8c88ae3e895cc0cb1bc7b24a48521..d77540803a12431d2b8c54928430e7494075a160 100644 (file)
@@ -1279,6 +1279,7 @@ PyMODINIT_FUNC initxc(void)
     d = PyModule_GetDict(m);
     xc_error = PyErr_NewException(XENPKG ".error", NULL, NULL);
     PyDict_SetItemString(d, "error", xc_error);
+    PyDict_SetItemString(d, "VIRQ_DOM_EXC", PyInt_FromLong(VIRQ_DOM_EXC));
 
     zero = PyInt_FromLong(0);
 
index d60c206382e6650e98b685c0b351e31c11daba1d..f02c772ac67bf1d8fc9e8610602db8d54594be9c 100755 (executable)
@@ -10,12 +10,6 @@ from xen.xend.XendLogging import log
 
 from messages import *
 
-VIRQ_MISDIRECT  = 0  # Catch-all interrupt for unbound VIRQs.
-VIRQ_TIMER      = 1  # Timebase update, and/or requested timeout.
-VIRQ_DEBUG      = 2  # Request guest to dump debug info.
-VIRQ_CONSOLE    = 3  # (DOM0) bytes received on emergency console.
-VIRQ_DOM_EXC    = 4  # (DOM0) Exceptional event for some domain.
-
 DEBUG = 0
 
 RESPONSE_TIMEOUT = 20.0
@@ -66,13 +60,8 @@ class ChannelFactory:
     def __init__(self):
         """Constructor - do not use. Use the channelFactory function."""
         self.notifier = xu.notifier()
-        # Register interest in all virqs.
-        # Unfortunately virqs do not seem to be delivered.
-        self.bind_virq(VIRQ_MISDIRECT)
-        self.bind_virq(VIRQ_TIMER)
-        self.bind_virq(VIRQ_DEBUG)
-        self.bind_virq(VIRQ_CONSOLE)
-        self.bind_virq(VIRQ_DOM_EXC)
+        # Register interest in virqs.
+        self.bind_virq(xen.lowlevel.xc.VIRQ_DOM_EXC)
         self.virqHandler = None
 
     def bind_virq(self, virq):
@@ -81,6 +70,7 @@ class ChannelFactory:
         log.info("Virq %s on port %s", virq, port)
 
     def virq(self):
+        log.error("virq")
         self.notifier.virq_send(self.virqPort)
 
     def start(self):
index 9fb257a43301bd6fe18bd33d8bb53fcd0692090e..f865d5d97761ecd19c30d389134bc5268ff77a56 100644 (file)
@@ -192,10 +192,21 @@ control_channel_t *add_virq(int virq)
     cc = (control_channel_t *)malloc(sizeof(control_channel_t));
     if ( cc == NULL ) return NULL;
 
+    memset(cc, 0, sizeof(control_channel_t));
     cc->type       = CC_TYPE_VIRQ;
     cc->local_port = virq_port;
     cc->virq       = virq;
+    cc->ref_count  = 1;
     
+    if (evtchn_bind(cc->local_port) != 0)
+    {
+        DPRINTF("Got control interface, but couldn't bind evtchan!\n");
+        free(cc);
+        return NULL;
+    }
+
+    cc_list[cc->local_port] = cc;
+
     return cc;
 }